"""
username:apply1
password:1234561
platformType:2
grant_type:password
client_secret:123456
client_id:client-app

"""
# 1.导包
import requests
from requests_toolbelt import MultipartEncoder
m= MultipartEncoder(
    fields={
        "username": "apply1",
        "password": "123456",
        "platformType": "2",
        "grant_type": "password",
        "client_secret": "123456",
        "client_id": "client-app"
                    }
)
# 2. 使用request
resq = requests.post("http://api.fnblog.cn/auth/oauth/token",
                    headers={"Content-Type":"multipart/form-data; boundary=----WebKitFormBoundaryrxU1zStbfCJyeRbI"},
                    data =  {
        "username": "apply1",
        "password": "123456",
        "platformType": "2",
        "grant_type": "password",
        "client_secret": "123456",
        "client_id": "client-app"
                    } )

# 3. 打印查看 文本 响应结果
print("返回結果:",resq.text)
print(type(resq.json()))
# 将响应结果，转换成 json 查看
print("返回結果:",resq.json())
print("返回令牌為:",resq.json().get('data'))